using System;
using System.Data;
using System.Collections.Generic;
using System.Collections;
using log4net;
using FSS.DAL.DBManagers;
using FSS.BLL.Entities;
namespace FSS.BLL.Services
{
	#region IModuleService

	/// <summary>
	/// ModuleService object for Ibatis mapped table 'Module'.
	/// </summary>
	public class IModuleService : BaseSqlMapDao
	{
		private static readonly ILog log = LogManager.GetLogger(typeof(IModuleService).Name);
	  	
		public IList<ModuleEntity> LoadAll()
        {
            try
            {
                return ExecuteQueryForList< ModuleEntity>("ModuleLoadAll", null);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
       public ModuleEntity LoadByPrimaryKey(ModuleEntity objE)
        {
            try
            {
                return ExecuteQueryForObject< ModuleEntity>("ModuleLoadByPrimaryKey", objE);
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return null;
            }
        }
        
        /// <summary>
        /// add new Module to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Insert(ModuleEntity objE)
        {
            try
            {
                ExecuteInsert("ModuleInsert", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        /// <summary>
        /// update Module to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Update(ModuleEntity objE)
        {
            try
            {
                ExecuteUpdate("ModuleUpdate", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
        /// <summary>
        /// delete Module to DB 
        /// </summary>
        /// <param name="objE"></param>
        /// <returns></returns>
        public int Delete(ModuleEntity objE)
        {
            try
            {
                ExecuteDelete("ModuleDelete", objE);
                return 1;
            }
            catch (Exception ex)
            {
                log.Debug(ex.Message);
                return 0;
            }
        }
	}
	#endregion  
}
